package com.lancoo.cvas.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lancoo.cvas.arrangecourse.entities.CourseUnit;
import com.lancoo.cvas.config.MybatisRedisCache;
import com.lancoo.cvas.entity.Schedule;
import com.lancoo.cvas.entity.ScheduleConflictInfo;
import com.lancoo.cvas.entity.TeachingClassWeek;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lancoo.cvas.pojo.dto.LockDto;
import org.apache.ibatis.annotations.CacheNamespace;

import java.util.List;

/**
 * 教学班对应上课周数
 *
 * @author liufeng
 * @email 1037383243@qq.com
 * @date 2023-12-04 11:54:00
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface TeachingClassWeekMapper extends BaseMapper<TeachingClassWeek> {

    List<TeachingClassWeek> getCourseWeeekNum(Integer taskId, Long courseId, List<Long> teachingClassIds, int deleted);

    /**
     * 批量插入教学班周次设置
     *
     * @param teachingClassWeeks
     * @return
     */
    Integer saveBatch(List<TeachingClassWeek> teachingClassWeeks);

    Boolean updateLocks(Integer isLocked, LockDto locks);

    List<Long> getUnScheduleTeachingClassIds(List<Long> tcIds, int unRange, int conflict, int deleted);

    List<TeachingClassWeek> getUnRange(Integer taskId, Integer roomType, int deleted);

    void updateScheduleState(int code, List<CourseUnit> list);
    void updateScheduleState1(int code, List<ScheduleConflictInfo> list);

    String getCourseRuleWeek(Integer taskId, Long courseId, int deleted);

    List<TeachingClassWeek> classStatistics(Integer taskId);

    int addBatch(List<TeachingClassWeek> teachingClassWeekCollection);

    List<TeachingClassWeek> getByTeachingClassIds(List<Long> teachingClassIds, int deleted);

    Page<TeachingClassWeek> getTeachingClassWeek(Page<TeachingClassWeek> page, String gradeId, Integer typeId, String classId, Integer isEnable, Integer taskId,Long courseId);
    Page<TeachingClassWeek> getSelectTeachingClassWeekPage(Page<TeachingClassWeek> page, String gradeId, Long courseId, Long teachingClassId, Integer isEnable, Integer taskId);
    Page<TeachingClassWeek> getSubTeachingClassWeekPage(Page<TeachingClassWeek> page, String gradeId,Integer subType, Long courseId, Long teachingClassId, Integer isEnable, Integer taskId);


    List<Long> getteachingClassByRoomId(Integer taskId, Long roomId, int deleted);

    void updateScheduleStateAndIsLocked(int scheduleState, List<Schedule> scheduleList);

    void setUnLock(Integer taskId);

    List<TeachingClassWeek> getUnNormal(Integer taskId);

    void removeUnSuit(Integer taskId, List<Long> tcIds, int unSuit, int normal);
}
